﻿using System.Collections.Generic;
using System.Data;

namespace DBBuilder.DBDataStructure
{
    /// <summary>
    /// Present database corresponding with database from database server
    /// </summary>
    public class DataBase
    {
        #region Fields

        /// <summary>
        /// List table of database, it is corresponding with tables from database
        /// </summary>
        public List<Table> Tables { get; set; }

        #endregion

        #region Constructors

        /// <summary>
        /// Initialize an instance of database based on list of data table
        /// </summary>
        public DataBase(IList<DataTable> lstDataTbl)
        {
            this.Tables = new List<Table>();
            foreach (DataTable dTbl in lstDataTbl)
            {
                var tbl = new Table(dTbl)
                              {
                                  DataBase = this
                              };
                this.Tables.Add(tbl);
            }
        }

        #endregion
    }

}
